package com.edu.enums;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.edu.common.model.KvEntity;


public enum Boolean {
	
	TRUE(1,"是"),
	FALSE(-1,"否");
	
	private Integer code;
	private String name;
	private static Map<Integer,String> map = new HashMap<Integer,String>();
	private static List<KvEntity> list = new ArrayList<KvEntity>();
	
	static{
		EnumSet<Boolean> set = EnumSet.allOf(Boolean.class);
		for(Boolean bool : set){
			map.put(bool.getCode(), bool.getName());
			list.add(new KvEntity(bool.getCode().toString(), bool.getName()));
		}
	}
	
	public static String getText(Integer code){
		return map.get(code);
	}
	
	public static List<KvEntity> getList(){
		return list;
	}
	
	private Boolean(Integer code,String name) {
		this.code = code;
		this.name = name;
	}

	public Integer getCode() {
		return code;
	}
	public void setCode(Integer pCode) {
		code = pCode;
	}
	public String getName() {
		return name;
	}
	public void setName(String pName) {
		name = pName;
	}
	
	
	

}
